<%@ page language="java" pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
<head>
	<html:base />

	<title>createProgram.jsp</title>
<link href="./css/xtab.css" rel="stylesheet" type="text/css" />
</head>

<body>
	<html:form action="/program.do?method=createProgram">

		<table cellspacing="0">

			<tr>
				<td class="tableTitle">
					维度名称
				</td>
				<td>
					<html:text property="program.programName" size="50"></html:text>
					<html:hidden property="program.programId"/>
				</td>
			</tr>
			<tr>
				<td class="tableTitle">
					维度描述
				</td>
				<td>
					<html:text property="program.description" size="50"></html:text>
				</td>
			</tr>
			
			 
			<tr>
				<td class="tableTitle">
					小区
				</td>
				<td>
					<input type="hidden" name="village" value="${program.village }">
					<input type="checkbox" name="selectVillage" onclick="selectAllVilage();">All <input type="text" readOnly="readOnly" size="50" name="villageName" id="villageName" value="${program.villageName }">  <input type="button" id="selectVillage" class="button" name="selectVillageButton" value="...">
				</td>
			</tr>
			<tr>
				<td class="tableTitle">
					频道
				</td>
				<td>
					<input type="hidden" name="channel" value="${program.chanenl }">
					<input type="checkbox" name="selectChannel" onclick="selectAllChannel();">All <input type="text" readOnly="readOnly" size="50" name="channelName" id="channelName" value="${program.channelName }"> <input type="button" id="selectChannel" class="button" name="selectChannelButton" value="...">
				</td>
			</tr>
			
			<tr>
				<td colspan="2">
					<input type="button" id="create" class="button" value="保 存">
				</td>
			</tr>
			
			 
			
		</table>
	
	</html:form>
	<script>
 
		$("#selectVillage").click(function(){
			window.open("village.do?method=selectVillage",null," height=300,width=450, Left=300px,Top=20px, menubar=no,titlebar=no,scrollbar=no,toolbar=no, status=no,location=no");
		}); 
		
		$("#selectChannel").click(function(){
			window.open("channel.do?method=selectchannel&p_id=0",null," height=300,width=450, Left=300px,Top=20px, menubar=no,titlebar=no,scrollbar=no,toolbar=no, status=no,location=no");
		});
		
		$("#create").click(function(){
			var f=document.forms[0];
			f.action="program.do?method=updateProgram";
			f.submit();
		}); 
		function selectAllVilage(){
			if(document.getElementsByName('selectVillage')[0].checked==true){
              	 document.getElementById("village").value="@allConditions@";
              	 document.getElementById("villageName").value="All";
              	 document.getElementById("selectVillageButton").disabled="disabled";
              } 
              else{
              	document.getElementById("village").value="";
              	 document.getElementById("villageName").value="";
              	  document.getElementById("selectVillageButton").disabled="";
              }  
		}
		function selectAllChannel(){
			if(document.getElementsByName('selectChannel')[0].checked==true){
              	 document.getElementById("channel").value="@allConditions@";
              	 document.getElementById("channelName").value="All";
              	  document.getElementById("selectChannelButton").disabled="disabled";
              } 
              else{
              	document.getElementById("channel").value="";
              	 document.getElementById("channelName").value="";
              	  document.getElementById("selectChannelButton").disabled="";
              }  
		}
	</script>
</body>
</html:html>
